package com.example.petstore_2.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.example.petstore_2.common.CommonResponse;
import com.example.petstore_2.domain.LineItem;
import com.example.petstore_2.domain.Order;
import com.example.petstore_2.mapper.LineItemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Service("lineItemService")
public class LineItemService {
    @Autowired
    private LineItemMapper lineItemMapper;

    public CommonResponse<List> getLineItemsByOrderId(int orderId) {
        List list = lineItemMapper.selectList(new QueryWrapper<LineItem>().eq("orderid", orderId));
        return CommonResponse.creatForSuccess(list);
    }
}
